import os
import django

# 设置 Django 环境
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'seckill_java_topy.settings')
django.setup()

from orders.tasks import example_task

def test_celery():
    print("提交异步任务...")
    result = example_task.delay('arg1', 'arg2')  # 异步调用任务
    print(f"任务 ID: {result.id}")

if __name__ == '__main__':
    test_celery()